package com.mina;

import java.net.InetSocketAddress;

import org.apache.mina.core.service.IoAcceptor;
import org.apache.mina.filter.codec.ProtocolCodecFilter;
import org.apache.mina.transport.socket.nio.NioSocketAcceptor;

public class Server {

	public static void main(String[] args){
		try{
			IoAcceptor acceptor = new NioSocketAcceptor();
	    	acceptor.getFilterChain().addLast("codec", new ProtocolCodecFilter( new ByteArrayCodecFactory()));
	    	acceptor.setHandler(new MinaHandler());
	    	acceptor.bind(new InetSocketAddress(8888));
	        System.out.println( "Server is running..." );
		}catch(Exception e){
			e.printStackTrace();
		}
	}
}
